package com.wangzhixuan.service.impl;

import java.util.List;
import java.util.Map;

import com.wangzhixuan.commons.utils.PageInfo;
import com.wangzhixuan.model.CusGroup;
import com.wangzhixuan.model.vo.CusMapVo;
import com.wangzhixuan.mapper.CusGroupMapper;
import com.wangzhixuan.service.ICusGroupService;
import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhixuan.wang
 * @since 2017-09-25
 */
@Service
public class CusGroupServiceImpl extends ServiceImpl<CusGroupMapper, CusGroup> implements ICusGroupService {
	
	@Autowired
    private CusGroupMapper cusGroupMapper;
    
	@Override
    public void selectDataGrid(PageInfo pageInfo) {
    	Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
        page.setOrderByField(pageInfo.getSort());
        page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
        List<CusGroup> list = cusGroupMapper.selectCusGroupPage(page, pageInfo.getCondition());
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

	@Override
	public List<Map<String, Object>> listCusGroup(Integer speId, Integer metId) {
		List<Map<String,Object>> listCusGroup = cusGroupMapper.listCusGroup(speId, metId);
		return listCusGroup;
	}

	public List<Map<String, Object>> listCus(Integer cusId, Integer speId,
			Integer metId) {
		List<Map<String, Object>> listCus = cusGroupMapper.listCus(cusId, speId, metId);
		return listCus;
	}

	@Override
	public Integer cusCounts(Integer cusId,Integer speId,Integer metId) {
		Integer counts = cusGroupMapper.cusCounts(cusId, speId, metId);
		return counts;
	}

	@Override
	public List<CusGroup> listCusGroup2() {
		List<CusGroup> listCusGroup2 = cusGroupMapper.listCusGroup2();
		return listCusGroup2;
	}

	@Override
	public List<CusMapVo> cusMapList() {
		List<CusMapVo> cusMapList = cusGroupMapper.cusMapList();
		return cusMapList;
	}

	@Override
	public Integer selectEnty(String content) {
		Integer groupId = cusGroupMapper.selectCusGroupId(content);
		return groupId;
	}
}
